package com.guldan.jaina.provider;

import com.guldan.core.constants.CommonConstant;
import com.guldan.core.dubbo.client.ResponseDTO;
import com.guldan.core.enums.UploadTypeEn;
import com.guldan.core.redis.CacheService;
import com.guldan.jaina.dto.progress.BarDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by Silas.
 * Date: 2016/12/31
 * Time: 16:53
 */
@Component
public class UploadProviderImpl implements IUploadProvider {


    @Autowired
    private CacheService cacheService;

    //获取上传导入进度条信息
    @Override
    public ResponseDTO<BarDTO> getBarDTO(String barId, Integer typeId) {
        ResponseDTO<BarDTO> responseDTO = new ResponseDTO<>();
        BarDTO barDTO = new BarDTO();
        /*if (typeId.equals(UploadTypeEn.register.getCode()))
            barDTO = (BarDTO) cacheService.getCache(barId);
        else if (typeId.equals(UploadTypeEn.citizen.getCode())) {
            barDTO = (BarDTO) cacheService.getCache(barId);
        } else if (typeId.equals(UploadTypeEn.citizen_update.getCode()))*/
        barDTO = (BarDTO) cacheService.getCache(barId);
        responseDTO.setData(barDTO);
        return responseDTO;
    }
}
